package com.aaa.web.controller.carmessagecontroller;

import com.aaa.entity.storecar.StoreCarMessage;
import com.aaa.web.commons.Result;
import com.aaa.web.commons.StoreCarQuery;
import com.aaa.web.service.carmessageservice.StoreCarMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @program:
 * @description: 门店电瓶车管理页面
 * @author: 许一鑫
 * @create: 20:01 2018/12/21
 **/
@Controller
@RequestMapping("/StoreCarMessageController")
public class StoreCarMessageController {
    /**
     * 自动注入service
     */
    @Autowired
    private StoreCarMessageService service;

    /**
     * 跳转门店电瓶车管理界面
     * @return
     */
    @RequestMapping("/GetStoreMessagePage")
    public String getStoreMessagePage(){
        return "views/webhtml/carmessage/storecarmessage";
    }

    /**
     * 查询所有门店电瓶车信息包含门店名，车型号， 出厂码，生产日期，售出日期，是否售出
     * @param query
     * @return
     */
    @RequestMapping("/GetStoreMessage")
    @ResponseBody
    public Map getStoreMessage(StoreCarQuery query){

        return service.getStoreMessage(query);
    }

    /**
     * 添加新的门店车辆信息，车型号，出厂码，门店，出厂日期
     * @param s
     * @return
     */
    @RequestMapping("/AddNewStoreCar")
    @ResponseBody
    public Result addNewStoreCar(StoreCarMessage s){
        return service.addNewStoreCar(s);
    }

    /**
     * 删除新增错误的入库信息
     * @param s
     * @return
     */
    @RequestMapping("/DelStoreCar")
    @ResponseBody
    public Result delStoreCar(StoreCarMessage s){
        return service.delStoreCar(s);
    }

    /**
     * 提交车主信息
     * @param s
     * @return
     */
    @RequestMapping("/AddCarUser")
    @ResponseBody
    public Result addCarUser(StoreCarMessage s){
        System.out.println("6666");
        return service.addCarUser(s);
    }
}
